package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.service.SendCodeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: liangWeiQUQ
 * @Description: 验证手机验证码
 * @DateTime: 2021/3/5 11:51
 **/
@RequestMapping("mobile/validateCode")
@RestController
@Slf4j
public class ValidateController {
    @DubboReference
    private SendCodeService sendCodeService;
    
    /**
       * @Author: 传闻中的梁大侠 
       * @Date: 11:56 2021/3/5
       * @Parms [type, telephone]
       * @ReturnType: com.itheima.health.entity.Result
       * @Description: 发送短信的验证码
     */
    
    @PostMapping("send")
    public Result sendCode(String type, String telephone) {

        sendCodeService.sendCode(type, telephone);
        return new Result(true, MessageConst.SEND_VALIDATECODE_SUCCESS);
    }
}
